///////////////////////////////////////////////////////////////////////////
//  Brainfreeze - Yet another sokoban puzzle game, this time in 3D
//  Copyright (C) 2006 Scott MacDonald
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License along
//  with this program; if not, write to the Free Software Foundation, Inc.,
//  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
///////////////////////////////////////////////////////////////////////////
// GameLevel.cpp - code definition for a sokoban game level
#include "StdAfx.h"
#include "GameSession.h"

GameSession::GameSession(void)
{
		//
		// load up a game board
		//
		int levelWidth = 11;
		int levelHeight = 8;
		char* level = "###########################  ####" \
                      "#       * ## ### @#  ##      #* #" \
                      "#     @#$ ############";;

		currentLevel = new GameLevel(levelWidth, levelHeight, level);
		currentLevelBase = new GameLevel(levelWidth, levelHeight, level);
}

///////////////////////////////////////////////////////////////////////////
// desctructor... what did you expect?
///////////////////////////////////////////////////////////////////////////
GameSession::~GameSession(void)
{
	if( currentLevel != NULL )
	{
		delete currentLevel;
		currentLevel = NULL;
	}

	if( currentLevelBase != NULL )
	{
		delete currentLevelBase;
		currentLevelBase = NULL;
	}
}

GameLevel* GameSession::GetLevel()
{
	return currentLevel;
}

void GameSession::ResetLevel()
{
	//
	// Remove the old level
	//
	if( currentLevel != NULL )
	{
		delete currentLevel;
		currentLevel = NULL;
	}

	currentLevel = new GameLevel(*currentLevelBase);
}